package com.rjwh.dingdong.client.util;

import android.content.Context;
import android.util.Log;

import com.rjwh.dingdong.client.application.MyApplication;
import com.rjwh.dingdong.client.player.PlayMode;
import com.rjwh.dingdong.client.constant.LocalConstant;
/**
 * Created with Android Studio.
 * User: ryan.hoo.j@gmail.com
 * Date: 9/10/16
 * Time: 11:05 PM
 * Desc: PreferenceManager
 */
public class PreferenceManager {


    public static PlayMode lastPlayMode(Context context) {

        String playModelName = MyApplication.getInstance().spUtil.getStrPreferenceByParamName(context,LocalConstant.SP_PLAYER_PLAY_MODE);
        Log.i("HTML","playModelName:"+playModelName);
        if (!playModelName.equals("")) {
            return PlayMode.valueOf(playModelName);
        }
        return PlayMode.getDefault();
    }


    public static void setPlayMode(Context context, PlayMode playMode) {
        MyApplication.getInstance().spUtil.setStrPreference(context, LocalConstant.SP_PLAYER_PLAY_MODE, playMode.name());
    }

}
